package com.java_foundation.util;

import java.util.Arrays;
import java.util.List;

/**
 * @program: java_foundation
 * @description: test
 * @author: xiongbangwen <Email>xiongbangwen@163.com</Email>
 * @create: 2020-05-29 11:18
 **/
public class Test {

    /*
    * @Description:
    * @Param: [args] 
    * @return: void 
    * @Author: xiongbangwen <Email>xiongbangwen@163.com</Email> 
    * @Date: 2020/5/29 13:59
    */
    public static void main(String[] args) {
        String name = "xiongbangwen";
        String result = StringUtil.subStringBefore(name,"bang");
        System.out.println(result);
        //输出：xiong
        String result1 = StringUtil.subStringBefore(name,"G");
        System.out.println(result1);
        //输出：xion
        String result2 = StringUtil.subStringAfter(name,"bang");
        System.out.println(result2);
        //输出：wen
        String result3 = StringUtil.subStringAfter(name,"G");
        System.out.println(result3);
        //输出：bangwen
        String result4 = StringUtil.singleQuotoAndEscape(name);
        System.out.println(result4);
        //输出：'xiongbangwen'
        String result5 = StringUtil.escapeSqlLike(name);
        System.out.println(result5);
        //输出：%xiongbangwen%
        String[] result6 = StringUtil.singleQuotoAndEscape(new String[]{"xiong", "bang", "wen"});
        System.out.println(Arrays.toString(new String[]{"xiong", "bang", "wen"}));
        //输出：[xiong, bang, wen]
        System.out.println(Arrays.toString(result6));
        //输出：['xiong', 'bang', 'wen']
        List<String> result7 = StringUtil.splitToList("xiong,bang,wen",",");
        System.out.println(result7.toString());
        //输出：[xiong, bang, wen]
        List<String> result8 = StringUtil.splitToListByUpStraight("xiong | bang | wen");
        System.out.println(result8.toString());
        //输出：[xiong, bang, wen]
        String result9 = StringUtil.replaceAllToEmpty(name,new String[]{"xiong", "bang"});
        System.out.println(result9.toString());
        //输出：wen
        String result10 = StringUtil.replaceAllTargetValue(name,"jizhiwen",new String[]{"xiong", "bang"});
        System.out.println(result10.toString());
        //输出：jizhiwenjizhiwenwen
        String result11 = StringUtil.combineToString(result7,"!");
        System.out.println(result11);
        //输出：xiong!bang!wen
        String result12 = StringUtil.subStringBeforeLastIgnoreCase(name,"bang");
        System.out.println(result12);
        //输出：xiong
        String result13 = StringUtil.subStringAfterLastIgnoreCase(name,"bang");
        System.out.println(result13);
        //输出：xwen
        int result14 = StringUtil.countMatches(name,"g");
        System.out.println(result14);
        //输出：2
    }
}
